<?php

class WSocialButton extends Portlet {

    public $type = 'horizontal';
    public $style = 'box';
    public $services = array("google-plus", 'twitter'); //"like"

    public function init() {
        parent::init();
        if(in_array('google-plus', $this->services)) {
            Yii::app()->clientScript->registerScriptFile('https://apis.google.com/js/plusone.js', CClientScript::POS_END);
        }
        if(in_array('twitter', $this->services)) {
            Yii::app()->clientScript->registerScriptFile('http://platform.twitter.com/widgets.js', CClientScript::POS_END);
        }
        if(in_array('like', $this->services)) {
            Yii::app()->clientScript->registerScriptFile('http://connect.facebook.net/en_US/all.js#appId=220227991326675&xfbml=1', CClientScript::POS_END);
        }
    }

    protected function renderContent() {
        $this->render("social_button_" . $this->type);
    }
}
